package com.lnlyj.media.data;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Wanglei on 2019/7/1.
 */

public class MediaGroup implements Parcelable {

    public long dateModified;
    public String time;
    public List<MediaItem> items = new ArrayList<>();

    public MediaGroup() {
    }

    protected MediaGroup(Parcel in) {
        dateModified = in.readLong();
        time = in.readString();
    }

    public static final Creator<MediaGroup> CREATOR = new Creator<MediaGroup>() {
        @Override
        public MediaGroup createFromParcel(Parcel in) {
            return new MediaGroup(in);
        }

        @Override
        public MediaGroup[] newArray(int size) {
            return new MediaGroup[size];
        }
    };

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MediaGroup that = (MediaGroup) o;

        return time != null ? time.equals(that.time) : that.time == null;
    }

    @Override
    public int hashCode() {
        return time != null ? time.hashCode() : 0;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeLong(dateModified);
        parcel.writeString(time);
    }
}
